* Table 2
local table "Table2"
use "./data/publications.dta", clear
createvarspub
keep if year>1999
keep if rebides==1
gen dum=0
replace dum=1 if year>1999 & year<2005
replace dum=2 if year>2004 & year<2010
replace dum=3 if year>2009 & year<2015
replace dum=4 if year>2014
qui putexcel set "./tables/tables.xlsx", sheet("`table'") modify
qui putexcel A1=("Institution")
qui putexcel B1=("99-04")
qui putexcel C1=("05-09")
qui putexcel D1=("10-14")
qui putexcel E1=("15-19")
local pos=2
foreach var of varlist ///
ulisboa unova uporto uminho bp ucoimbra iscte ucp ///
uevora ubi uaveiro ualgarve uacores ///
umadeira utad {
preserve
keep if `var'==1
qui putexcel A`pos'=("`var'")
* Count articles
forval i=1/4 {
unique article_id if dum==`i'
local nart=r(unique)
unique person_id if dum==`i'
local nau=r(unique)
local col=char(65+`i')
qui putexcel `col'`pos'=(" `nart'/`nau' ")
}
local ++pos
restore
}
